package com.zhuangjie.shop.controller;


import com.zhaungjie.base.conduit.R;
import com.zhuangjie.security.annotations.NoAuthentication;
import com.zhuangjie.shop.service.ShopCategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 * 店铺类型 前端控制器
 * </p>
 *
 * @author zhuangjie
 * @since 2023-09-24
 */
@RestController
@RequestMapping("/shop-category")
@Api(tags="店铺分类")
public class ShopCategoryController {
    @Resource
    private ShopCategoryService shopCategoryService;

    @GetMapping("/list")
    @NoAuthentication
    @ApiOperation("获取店铺分类所有列表")
    @Cacheable(value = {"shop-category"}, key = "#root.method.name", sync = true) // sync解决缓存击穿
    public R list() {
        return R.ok().data(shopCategoryService.list());
    }
}

